package main

import (
	"github.com/gin-gonic/gin"
	"github.com/gin-contrib/cors"
	_ "github.com/jinzhu/gorm/dialects/postgres"

	"yangbo/common"
)


//noinspection ALL
func main() {
	db := common.InitDB()
	defer db.Close()
	//创建路由
	r := gin.Default()
	//Cors解决跨域问题
	r.Use(cors.Default())
	r = CollectRoute(r)
	//port := viper.GetString("server.port")
	//if port != ""{
	//	panic(r.Run(":" + port))
	//}else {
	//	panic(r.Run())// listen and serve on 0.0.0.0:8080
	//}
	panic(r.Run(":8091"))
}